Skip to content

Conversation

Shivs11
Copy link
Member

@Shivs11 Shivs11 commented Sep 30, 2025

What was changed

  • WISOTT

Why?

  • Extend the controller to users who use API's to connect to Temporal cloud namespaces

Checklist

  1. Closes
    Add API Keys support #144

  2. How was this tested:

  • Added unit tests
  • Ran the controller locally with both API and mTLS auth
  • Existing suite of integration tests
  1. Any docs updates needed?
  • Updated demo README and relevant scripts as they were out of date.

@Shivs11 Shivs11 marked this pull request as ready for review September 30, 2025 17:17
@Shivs11 Shivs11 requested review from a team and jlegrone as code owners September 30, 2025 17:17
jacobstr added a commit to jacobstr/temporal-worker-controller that referenced this pull request Oct 7, 2025
Supporting review comments in temporalio#149
which I'd like to see over the line.
@@ -0,0 +1,66 @@
---
apiVersion: rbac.authorization.k8s.io/v1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was accidentally committed (sidenote, we should fix the make manifests target to put these files in the right place after generating them, but for this PR just remove the extra files)

@@ -0,0 +1,26 @@
---
apiVersion: admissionregistration.k8s.io/v1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Comment on lines +58 to +78
func resolveAuthSecretName(tc *temporaliov1alpha1.TemporalConnection) (clientpool.AuthMode, string, error) {
auth := getAuthMode(tc)
switch auth {
case clientpool.AuthModeTLS:
name, err := getTLSSecretName(tc.Spec.MutualTLSSecretRef)
return auth, name, err
case clientpool.AuthModeAPIKey:
name, err := getAPIKeySecretName(tc.Spec.APIKeySecretRef)
return auth, name, err
default:
return auth, "", nil
}
}

func getAuthMode(temporalConnection *temporaliov1alpha1.TemporalConnection) clientpool.AuthMode {
if temporalConnection.Spec.MutualTLSSecretRef != nil {
return clientpool.AuthModeTLS
} else if temporalConnection.Spec.APIKeySecretRef != nil {
return clientpool.AuthModeAPIKey
}
return clientpool.AuthModeNoCredentials
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I only see getAuthMode used in this one place, so it's more concise to just do:

func resolveAuthSecretName(tc *temporaliov1alpha1.TemporalConnection) (clientpool.AuthMode, string, error) {
    if temporalConnection.Spec.MutualTLSSecretRef != nil {
		name, err := getTLSSecretName(tc.Spec.MutualTLSSecretRef)
		return clientpool.AuthModeTLS, name, err
    } else if temporalConnection.Spec.APIKeySecretRef != nil {
		name, err := getAPIKeySecretName(tc.Spec.APIKeySecretRef)
		return clientpool.AuthModeAPIKey, name, err
    }
	return clientpool.AuthModeNoCredentials, "", nil
}

namespace: "" # e.g. default
# Use existing connection (leave empty to create new one)
connectionName: "" # e.g. dev-server
# Connection details (required if connectionName is empty)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Connection details (required if connectionName is empty)
# Connection details (either mtlsSecretName or apiKey is required if connectionName is empty)

(Or feel free to say that only one or the other is required in another way)

"properties": {
"name": {
"type": "string",
"description": "Name of the secret containing API key (required if connectionName is empty)"
Copy link
Collaborator

@carlydf carlydf Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this says that both apiKey and mtlsSecretName are required but only one or the other is required -- right?

Copy link
Collaborator

@carlydf carlydf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved once the extra config/ files are deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants